home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 015a / xset20.zip / XSET.DOC < prev    next >
Text File  |  1992-01-29  |  11KB  |  333 lines

  1.     ┌────────────────────────────────────────────────────────────┐
  2.     │   ENHANCED  SET  INSTRUCTION 2.0  -  (C) 1992 STERN Marc   │
  3.     └────────────────────────────────────────────────────────────┘
  4.  
  5.  
  6.     All you always wanted to put in an environment variable and
  7.  never dare to ask DOS for...
  8.  
  9.         XSET: The way to easily write efficient batch files.
  10.  
  11.  
  12.     XSET allows you to put EVERYTHING you want in a variable of
  13.  the current environment and use it as if you gave it the value with
  14.  the standard DOS command 'SET'. You will be able to write very efficient
  15.  batch files including string manipulation, calculation,...
  16.  
  17.     XSET is the more powerful environment variable manipulation
  18.  program you never saw. It also has the easiest and most intuitive
  19.  user interface it is possible to write.
  20.                                                             
  21.  
  22.  XSET is fully compatible with MS-DOS 5.0, DR-DOS 6.0, NDOS & 4DOS 4.0 .
  23.  
  24.  
  25.  
  26.  XSET has five major features:
  27.  ════════════════════════════
  28.  
  29.   - XSET permits to catch the output of any command (internal or external)
  30.     or program and put it into an environment variable.
  31.  
  32.   - XSET has several built-in commands to modify the output of a program
  33.     or a string given on the command-line (extract a part of a string,...)
  34.  
  35.   - XSET has a built-in full floating-point calculation functionalitie:
  36.                         ──────────────────────────────────────────────
  37.     You can make incremental loops, input a calculation string and
  38.     output a number,...
  39.  
  40.   - XSET can manage variable contents of more than 128 characters
  41.     (your path can now be as long as you want)
  42.     
  43.   - XSET has some other built-in commands to give you access to some
  44.     system datas (date, time, ...)
  45.  
  46.  
  47.  
  48.   * type XSET with no parameters to have the full description
  49.     of all functionalities (parameters and effects).
  50.  
  51.  
  52.  
  53.  Example of use:
  54.  ══════════════
  55.  
  56.   Rem: in all the examples, the command XSET and the its built-in commands
  57.        are typed in uppercase and the environment variables names are
  58.        in lowercase. This is only for readability; when you type it,
  59.        you may mix lowercases and uppercase as you want.
  60.        The case is only significant for arguments strings you enter on the
  61.        command-line.
  62.        The 'C:>' represents your prompt, do not type it!
  63.  
  64.  
  65.   1)      C:> XSET datvar DATE
  66.   Puts the date into the variable 'datvar'
  67.  
  68.   Type the command SET and you will see all the environment variables:
  69.           ...
  70.           COMSPEC=...
  71.           DATVAR=dd-mm-yy    (where dd,mm,yy are replaced by current
  72.                            day, month and year)
  73.           ...
  74.  
  75.   You can now use the variable 'datvar' in a batch file:
  76.           ECHO the date is %datvar%
  77.  
  78.   2)      C:> XSET name INPUT "Enter your name: "
  79.   Inputs a string from the keyboard (usual answer terminated by <Enter>)
  80.   and puts it into the variable 'name'.
  81.  
  82.   You can now use the variable 'name' in a batch file to enter
  83.   personal environment for each user:
  84.           ECHO Hello %name%, beginning the work
  85.           CD \%name%
  86.  
  87.     
  88.   3)      C:> CD | XSET dirname
  89.   Puts the output of the command 'CD' (i.e. the current directory name)
  90.   into the variable 'dirname'.
  91.  
  92.   You can write a batch file to go to another directory, execute
  93.   a program and come back into the current one
  94.  
  95.     rem ------------------
  96.  
  97.     CD | XSET dirname
  98.     CD \otherdir
  99.     myprog ...
  100.        cd %dirname%
  101.        set dirname=
  102.  
  103.        rem ------------------
  104.  
  105.  
  106.  
  107.   4)  You can write a batch file with automatic loops
  108.  
  109.  
  110.       rem ------------------
  111.  
  112.       set loop=1
  113.  
  114.         :next                         
  115.               if %loop% == 20 goto end
  116.  
  117.               .......
  118.               anything you want
  119.               .......
  120.  
  121.               XSET loop MATH %loop% + 1
  122.  
  123.               goto next
  124.               
  125.         :end
  126.  
  127.        rem ------------------
  128.  
  129.  
  130.   5)  You can write a batch file where the user may enter
  131.       a calculation and use it as a number
  132.  
  133.  
  134.       rem ------------------
  135.                                           
  136.       XSET calc INPUT "Enter your calculation: "
  137.  
  138.         XSET result MATH %calc%
  139.  
  140.         echo %calc% = %result%
  141.  
  142.        rem ------------------
  143.  
  144.  
  145.  
  146.  
  147.   6)  More complex example of a login procedure
  148.  
  149.           rem ---------------------- LOGIN.BAT --------------------------------
  150.  
  151.           echo off
  152.           cls
  153.  
  154.           rem    Ask login name from keyboard
  155.           rem    ----------------------------
  156.           XSET login INPUT "Enter login name : "
  157.  
  158.           rem    Test if directory corresponding to login name already exist
  159.           rem    -----------------------------------------------------------
  160.           if exist c:\%login%\nul goto LOGIN
  161.  
  162.           rem    Directory does not exist, ask to create it
  163.           rem    ------------------------------------------
  164.           echo:
  165.           echo Login '%login%' does not exist.
  166.           echo Do you want to create it? (Y/N)
  167.  
  168.           rem    Only "yYnN" keys are allowed
  169.           rem    ----------------------------
  170.           XSET ask KEY "yYnN"
  171.           XSET ask UPPER %ask%
  172.           if "%ask%" == "N" goto INPUT
  173.  
  174.           rem    Create directory
  175.           rem    ----------------
  176.           md c:\%login%
  177.  
  178.           :LOGIN
  179.           set ask=
  180.  
  181.           cd \%login%
  182.           if exist autouser.bat autouser.bat
  183.  
  184.           rem -----------------------------------------------------------------
  185.  
  186.   7)  And much more ...
  187.  
  188.  
  189.   Installation:
  190.   ════════════
  191.  
  192.      - XSET.EXE is ready to use; no installation,
  193.        but it is a SHAREWARE version.
  194.  
  195.      - To get a registered version of XSET, print the XSET.REG file,
  196.        fill it and send it to me; you will then receive the password
  197.        mandatory to use the program REGISTER.
  198.        
  199.      - if a registered people gave you the program (the shareware version 
  200.        obviously), put his name to the registration formular; he will
  201.        so receive each new upgrade for free!!!
  202.  
  203.  
  204.   Problems:
  205.   ════════
  206.   
  207.      - If the size of your environment space is not big enough,
  208.        you will receive an error message
  209.  
  210.              'XSET : not enough environment space.'
  211.              
  212.        This is not a bug, it is because the environment space
  213.        reserved for the variables is too small. 
  214.        You must increase it by modifying the line 'SHELL=...'
  215.        in your CONFIG.SYS. By default, DOS reserves 256 bytes
  216.        environment space; this is generally insufficient.
  217.        Try 640 bytes (or more if you need it) by adding '/e:640'
  218.        at the line 'SHELL=...'                           
  219.        
  220.        ex:    SHELL=COMMAND.COM /E:640 /P
  221.  
  222.  
  223.  
  224.   Additional information:     32.2.427.98.52 (after 19h)
  225.   ══════════════════════   or 32.2.465.01.19
  226.  
  227.                   E-mail:     stern@mble.philips.be
  228.  
  229.  
  230.  
  231.         ┌────────────────────────────────────────────────────────────┐
  232.         │   ENHANCED  SET  INSTRUCTION 2.0  -  (C) 1991 STERN Marc   │
  233.         └────────────────────────────────────────────────────────────┘
  234.  
  235.              Syntax:     XSET  <dosvar>  COMMAND  [args..]
  236.  
  237. Commands    Arguments    Action and value assigned to <dosvar>
  238. --------    ---------    -------------------------------------
  239.  
  240. INPUT       [prompt]     echo <prompt> and read input from standard input
  241.                          ex:  XSET name INPUT Enter your name:
  242.  
  243. PASSWD      [prompt]     same as INPUT without echoing
  244.  
  245. APPEND      {string}     old value + <string>
  246.                          ex:  XSET path APPEND ;c:\msc600\bin;c:\msc600\binb
  247.                          Rem: this allow you to bypass the 128 characters
  248.                               limit of DOS
  249.  
  250. KEY         string       key pressed (must be in <string> if not empty)
  251.                          ex:  XSET k KEY 123aAbB
  252.                               only keys 123aAbB are allowed
  253.                          ex:  XSET k KEY
  254.                               all are allowed
  255.  
  256. LENGTH      {string}     number of characters in <string>
  257.  
  258. LEFT        n {string}   the leftmost <n> characters of <string>
  259.                          ex: XSET var LEFT 3 abcdef
  260.                              puts 'abc' in variable 'var'
  261.                          
  262. MID         m n {string} the <n> characters in <string> starting from the <m>th
  263.  
  264. RIGHT       n {string}   the rightmost <n> characters of <string>
  265.  
  266. UPPER       {string}     uppercase <string>
  267.  
  268. LOWER       {string}     lowercase <string>
  269.  
  270. COUNT       {string}     the number of words in <string>
  271.  
  272. WORD        n {string}   pick the <n>-th word in <string>
  273.  
  274. LINE        n            read the <n>-th line from standard input
  275.  
  276. STDERR      n            read the <n>-th line from standard error
  277.  
  278. MATH        {expr}       result of calculation of expression <expr>
  279.                          valid operators: + - * / ()   on floats
  280.                                           + - * / () %% on integers
  281.                          ex: XSET var MATH 3+(2*5) + %new%
  282.  
  283. MIN      ┌{str1...strn}    minimum or maximum of numbers or strings list
  284. MAX      └{num1...numn}    (one string may not contain <space> or <tab>)
  285.                            ex: XSET var MIN 3.6 4 9.02
  286.                            ex: XSET var MAX 3.6 4 abc 3.9j
  287.  
  288. DATE                     system date (dd-mm-yy)
  289.  
  290. DAY                      day of the month (1-31)
  291.  
  292. MONTH                    month number (1-12)
  293.  
  294. YEAR                     system year (4 digits)
  295.  
  296. TIME                     system time (hh:mm:ss - 24h format)
  297.  
  298. HOUR                     system hour (0-24)
  299.  
  300. MINUTE                   system minutes (0-59)
  301.  
  302. SEC                      system seconds (0-59)
  303.  
  304. DENSITY     drive        drive density (360, 720, 1200, 1440 or 0)
  305.  
  306. DIR         [drive]      current directory of <drive> or current drive
  307.  
  308. FPATH       {file}       full pathname of a filename
  309.  
  310. FDRIVE      {file}       drive of a filename
  311.  
  312. FDIR        {file}       drive & directory of a filename
  313.  
  314. FEXT        {file}       extension of a file name (no period included)
  315.  
  316. FNAME       {file}       name of a file without extension
  317.  
  318. FXNAME      {file}       name & extension of a file
  319.  
  320. FSIZE       {file}       size of a file
  321.  
  322. TRUENAME    {file}       full truename of a file
  323.                                                 
  324.  
  325.   [...] are optional arguments.
  326.  
  327.   If arguments {...} are missing, they are read from the standard input.
  328.   Non quoted arguments on command-line will be separated by 1 blank.
  329.  
  330.   Rem:    'XSET var'   is equivalent to  'XSET var INPUT'
  331.                                      or  'XSET var LINE 1'
  332.                    and is more performant.
  333.